package cola0502.project.hellospringbootcola0502.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

// @Configuration
public class Knife4jConfiguration {
    @Bean
    public Docket docket(){
        ApiInfo apiInfo = new ApiInfoBuilder()
            .version("1.0.0")
            .description("本文档描述了HelloSpringBoot-Cola0502 系统服务接口定义")
            .contact(new Contact("Cola0502", "https://gitee.com/cola0223", "1203952894@qq.com"))
            .title("HelloSpringBoot-Cola0502 Swagger")
            .build();
        return new Docket(DocumentationType.SWAGGER_12)
            .groupName("adminApi")
            .apiInfo(apiInfo)
            .select()
            /*
             * 只显示admin路径下的页面
             * */
            .apis(RequestHandlerSelectors.basePackage("cola0502.project.hellospringbootcola0502.controller"))
            .paths(PathSelectors.regex("/v1/api/.*"))
            .build();

    }
}
